package com.codi.jobservice.job;

import com.codi.base.exception.BaseAppException;
import com.codi.base.spring.SpringContextHolder;
import com.codi.bus.core.service.FundNetValueBackService;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.quartz.QuartzJobBean;

@DisallowConcurrentExecution
public class FundNetvaluePerformanceJob extends QuartzJobBean{
    private static final Logger logger = LoggerFactory.getLogger(FundNetvaluePerformanceJob.class);

    @Override
    protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        FundNetValueBackService fundNetValueBackService = SpringContextHolder.getBean("fundNetValueBackService");
        logger.debug("update fund net value begin");

        try {
            fundNetValueBackService.updateFundNetValue();
        } catch (BaseAppException e) {
            logger.error(e.getMessage(), e);
        }

        logger.debug("update fund net value end");
    }
}
